let newappid;
new service(`${CONST.TABLE_PREFIX}_application_browse`).invoke(params.copyid,params.copyid).then(result=>{
	if(result.length === 0) return Promise.reject('not found copy application info');
	let info = result[0];
	info.name = params.name;
	return new action(`${CONST.TABLE_PREFIX}_application_insert`).excute(info);	
}).then(result=>{
	return new service(`${CONST.TABLE_PREFIX}_application_browse`).invoke(params.name,params.name);
}).then(result=>{
	newappid = result[0].id;
	return new service(`${CONST.TABLE_PREFIX}_appandresource_copy`).invoke(newappid,params.copyid);
}).then(result=>{
	return new service(`${CONST.TABLE_PREFIX}_authorization_copy`).invoke(newappid,params.copyid);
}).then(result=>{
	ret(null,'复制成功!');
}).catch(err=>{
	if(newappid) new action(`${CONST.TABLE_PREFIX}_application_delete`).excute({id:newappid});
	ret(err);
});
